package com.guchenbo.example.dubbo.rpc.manual;

import com.guchenbo.example.dubbo.template.InvokerTemplate;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcException;

public class ConsumerInvoker<T> extends InvokerTemplate<T> {

  private Invoker<T> provider;

  public ConsumerInvoker(Class<T> type, URL url, Invoker<T> provider) {
    super(type, url);
    this.provider = provider;
  }

  @Override
  protected Result doInvoke(Invocation invocation) throws RpcException {
    return provider.invoke(invocation);
  }
}
